home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_2 / tw21114.zip / TW2.H < prev    next >
C/C++ Source or Header  |  1992-06-01  |  17KB  |  346 lines

  1. /*
  2.         TW2.H -- Tradewars 2 C header file.
  3.  
  4.         Selected portions of the TW2.H file.
  5.  
  6. */
  7.  
  8. typedef unsigned char Uchar;
  9. typedef unsigned int  Uint;
  10. typedef unsigned long Ulong;
  11.  
  12. // 'killed by' definitions..
  13. #define CABAL   -1
  14. #define DELETED -2
  15. #define UNKNOWN -3
  16. #define MINE    -4
  17. #define ACTIVE  -5
  18. #define PIRATES -6
  19.  
  20. /* struct _PLYROPTS
  21.  
  22.     -- boolean switches in player records -- used in struct _PLAYER
  23.  
  24. */
  25.     struct _PLYROPTS
  26.     {
  27.         unsigned    Kloak:    1;             // cloaking device
  28.         unsigned    Graphics: 2;             // graphics (None, Color,
  29.                                              // C/G w/o msc, C/G w/ music)
  30.         unsigned    RTOnNow:  1;             // REAL TIME: using TW now
  31.         unsigned    Banished: 1;             // Restricted from plane 0
  32.         unsigned    MailWaiting: 1;          // has mail waiting
  33.     };
  34.  
  35. // union _WASCABAL_ used in _TWMAIN (formerly..  prior to ver 11)
  36.  
  37. union _WASCABAL_
  38.     {
  39.         char FreeForUse[23];
  40.         struct _OLDCABAL
  41.             {
  42.                 unsigned    regen;           // cabal regeneration
  43.                 unsigned    hq;              // cabal HQ location
  44.                 unsigned    Secndry;         // secondary force location
  45.                 unsigned    loc1;            // location around base #1
  46.                 unsigned    loc2;            // location around base #2
  47.                 unsigned    loc3;            // location around base #3
  48.                 unsigned    loc4;            // location around base #4
  49.                 unsigned    loc5;            // location around base #5
  50.                 unsigned    loc6;            // location around base #6
  51.                 unsigned    type2;           // number of cabal group 2 ftrs
  52.                 unsigned    type3;           // number of cabal group 3 ftrs
  53.                 char        strength;        // cabal strength level 1 - 10
  54.             } OldCabal;
  55.     };
  56.  
  57. // union _WASOPTIONS_  formerly used in _TWMAIN - NOT USED!
  58.  
  59. union _WASOPTIONS_
  60.     {
  61.         int Unused;
  62.         struct _OLDOPTIONS
  63.             {
  64.                 unsigned    aliases:  1;     // aliases on/off
  65.                 unsigned    network:  1;     // network on/off
  66.                 unsigned    news:     1;     // galactic news on/off
  67.                 unsigned    debug:    1;     // debug on/off
  68.                 unsigned    bbs_type: 4;     // bbs interface type
  69.                 unsigned    GMon:     1;     // using GMon??
  70.                 unsigned    externm:  1;     // external maintenance
  71.                 unsigned    local_password: 1; // ask for local password?
  72.                 unsigned    sales:    1;     // sales allowed??
  73.                 unsigned    surr:     1;     // surrender allowed?
  74.                 unsigned    show_dead: 1;    // show dead in rankings?
  75.                 unsigned    MoreThan1K: 1;   // More than 1K sectors?
  76.                 unsigned    Restricted: 1;   // restricted access for studs
  77.             } Option;
  78.     };
  79.  
  80. /* struct _TWMAIN
  81.  
  82.     -- file structure of main TW data file
  83.  
  84. */
  85. struct _TWMAIN
  86.     {
  87.         char        EditorPassword[13];      // password used to enter TWEDT
  88.         unsigned    StartingYear;            // starting year of game
  89.         unsigned    TurnsPerDay;             // turns per day allowed
  90.         unsigned    StartingFighters;        // starting fghter amount
  91.         unsigned    StartingCredits;         // starting credit amount
  92.         unsigned    StartingHolds;           // starting hold amount
  93.         unsigned    DaysInactive;            // max days of inactivity
  94.         unsigned    LastMaintenance;         // last day of maintenance
  95.         unsigned    NewsDays;                // days to save newspaper
  96.         unsigned    NewsDeleted;             // last day paper deleted
  97.         float       BankInterest;            // todays bank interest
  98.         unsigned    MaxHolds;                // maximum holds allowed in TW
  99.         unsigned    MaxOre;                  // max planet prod of ore
  100.         unsigned    MaxOrg;                  // max planet prod of org
  101.         unsigned    MaxEqp;                  // max planet prod of eqp
  102.         unsigned    FighterPrice;            // todays fighter price
  103.         union       _WASOPTIONS_ Old;        //
  104.         unsigned    CabalBounty;             // todays cabal bounty
  105.         union       _WASCABAL_ Was;          //
  106.         unsigned    AutoLogOff;              // time in minutes before tmout
  107.         unsigned    MaxTime;                 // max time in minutes no montr
  108.         char        BBSInfoFile[65];         // file to get BBS info from
  109.         char        RankFileName[65];        // file for player rankings
  110.         char        BBSSysopName[32];        // BBS SysOp name       (n-a-u)
  111.         char        BBSName[41];             // BBS name (not always used)
  112.         char        PortNumber;              // port num (not always used)
  113.         unsigned    ModemLockSpeed;          // speed of locked port (n-a-u)
  114.         int         BBSMode;                 // running in bbs mode? y/n (n-u)
  115.         char        ReservedPortionA[67];    // Reserved for use by TW2
  116.         int         TW2Version;              // version number of tw
  117.         char        MaxNodes;                // number of nodes (for chat)
  118.         int         PlanetRecords;           // records in planet file
  119.         int         PlayerRecords;           // records in user file
  120.         int         TeamRecords;             // records in team file
  121.         char        Language[4];             // language file extension
  122.         Uchar       BBSType;                 // BBS type
  123.         unsigned long TWOptions;             // home of options
  124.         long        BanishValue;             // if restrict studs, this Value
  125.         char        TWDirectory[65];         // directory TW data files are in
  126.         int         MaxPlayers;              // maximum player total
  127.         int         InputBuffer;             // input comm buffer
  128.         int         OutputBuffer;            // output comm buffer
  129.         char        NetDirectory[65];        // area for TW2NET.DAT/TW2NET.INC
  130.         char        MsgDirectory[65];        // TW msg base directory
  131.         Uchar       NetNode;                 // TW network node number
  132.         int         Net;                     // Regular network #
  133.         int         Node;                    // Regular node #
  134.         int         NodesInNet;              // Nodes in the network
  135.         char        PackerName[13];          // Network packer filename
  136.         char        PackerOptions[10];       // Packer command options
  137.         char        ChatFileDirectory[65];   // Drive/Directory for chat file
  138.         char        ReservedPortionB[30];    // Reserved for use by TW2
  139.         char        Unused[300];             // not currently in use..
  140.     };
  141.  
  142. /*  struct _PLAYER
  143.  
  144.     -- structure for each record of TWPLAYER.DAT
  145.  
  146. */
  147. struct _PLAYER
  148.     {
  149.         char        RealName[31];            // players real (BBS) name
  150.         char        Alias[31];               // players alias name (if any)
  151.         char        Password[9];             // local password
  152.         struct      _PLYROPTS Options;       // use: Player.Options.etc
  153.         unsigned    LastOn;                  // last day on
  154.         int         DestroyedBy;             // player killed by
  155.         unsigned    TurnsLeft;               // turns left on last day
  156.         unsigned    SectorIn;                // current sector in
  157.         unsigned    LastSectorIn;            // last sector in
  158.         Ulong       BankCredits;             // banked credits
  159.         Ulong       Credits;                 // trading credits
  160.         unsigned    Fighters;                // fighters w/ ship
  161.         unsigned    Mines;                   // mines w/ ship
  162.         unsigned    Kloak;                   // cloak days left (if any)
  163.         unsigned    Probes;                  // probes w/ ship
  164.         unsigned    Holds;                   // holds w/ ship
  165.         unsigned    Ore;                     // ore in holds
  166.         unsigned    Org;                     // organics in holds
  167.         unsigned    Eqp;                     // equipment in holds
  168.         unsigned    TeamIn;                  // team in (if any)
  169.         unsigned    DayQuitTeam;             // day player quit team
  170.         unsigned    TimeUsed;                // time used today
  171.         int         RTAttackBy;              // REAL TIME: attacked by
  172.         unsigned    UnusedInt;               // pointer to next lower player
  173.         long        UnusedLong;              // value of player
  174.         unsigned    SuperSearch;             // super sector finder onboard
  175.         unsigned    RTMessage;               // REAL TIME: radio msg
  176.         unsigned    LastMsgRead;             // Last message number read
  177.         char        JustPlainUnused[36];     // not currently in use..
  178.     };
  179.  
  180. /*  struct _SECTOR
  181.  
  182.     -- structure for each record of TWSECTOR.DAT
  183.  
  184. */
  185. struct _SECTOR
  186.     {
  187.         unsigned    DefenseForce;            // sector defense force ftr #
  188.         int         DFOwner;                 // owner of those fighters
  189.         unsigned    Port;                    // port in sector (if any)
  190.         unsigned    Planet;                  // planet in sector (if any)
  191.         unsigned    Mine;                    // mine in sector (if any)
  192.         char        InUnion;                 // is sector in union??
  193.         unsigned    DefenseOptions;          // Defense Force options
  194.         unsigned    OptionWork;              // Work Integer For above
  195.         unsigned    MineOptions;             // Mine Programming Options
  196.         unsigned    MOWork;                  // Mine Option Work
  197.         char        Unused[31];              // not currently in use..
  198.     };
  199.  
  200. /*  struct _PORT
  201.  
  202.     -- structure for each record of TWPORT.DAT
  203.  
  204. */
  205. struct _PORT
  206.     {
  207.         char        Name[30];                // name of port
  208.         char        Class;                   // class of port 0, 1, 2, 3
  209.         unsigned    RecalcDay;               // last day materials recalc'd
  210.         unsigned    RecalcMin;               // last min materials recalc'd
  211.         int         OreUnits;                // units of ore
  212.         int         OrgUnits;                // units of organics
  213.         int         EqpUnits;                // units of equipment
  214.         unsigned    OreProd;                 // productivity of ore per day
  215.         unsigned    OrgProd;                 // productivity of org per day
  216.         unsigned    EqpProd;                 // productivity of eqp per day
  217.         int         OreCost;                 // cost of ore %/thsnd units
  218.         int         OrgCost;                 // cost of org %/thsnd units
  219.         int         EqpCost;                 // cost of eqp %/thsnd units
  220.         unsigned    OreFract;                // 1/10000's units of ore
  221.         unsigned    OrgFract;                // 1/10000's units of organics
  222.         unsigned    EqpFract;                // 1/10000's units of eqp
  223.         char        Unused[20];              // not currently in use..
  224.     };
  225.  
  226. /*  struct _PLANET
  227.  
  228.     -- structure for each record of the TWPLANET.DAT file
  229.  
  230. */
  231. struct _PLANET
  232.     {
  233.         char        Name[30];                // name of planet
  234.         unsigned    Owner;                   // owner of planet
  235.         unsigned    RecalcDay;               // last day materials recalc'd
  236.         unsigned    RecalcMin;               // last min materials recalc'd
  237.         unsigned    OreUnits;                // amount of ore
  238.         unsigned    OrgUnits;                // amount of organics
  239.         unsigned    EqpUnits;                // amount of equipment
  240.         unsigned    OreProd;                 // productivity of ore
  241.         unsigned    OrgProd;                 // productivity of organics
  242.         unsigned    EqpProd;                 // productivity of equipment
  243.         unsigned    OreFract;                // 1/10000's units of ore
  244.         unsigned    OrgFract;                // 1/10000's units of org
  245.         unsigned    EqpFract;                // 1/10000's units of eqp
  246.         char        Factory;                 // factory  yes/no
  247.         unsigned    Workers;                 // number of workers
  248.         unsigned    Pay;                     // pay for each worker per day
  249.         long        Cash;                    // factory cash available
  250.         unsigned    FactoryOre;              // factory ore supply
  251.         unsigned    FactoryOrg;              // factory organics supply
  252.         unsigned    FactoryEqp;              // factory equipment supply
  253.         unsigned    FactoryFighters;         // fighter supply
  254.         unsigned    DefenseForce;            // Planetary Defense force
  255.         int         DefenseOwner;            // Defense force owner
  256.         unsigned    DefenseOptions;          // DF Options
  257.         unsigned    OptionWork;              // Option work area
  258.         char        Unused[22];              // not currently in use..
  259.     };
  260.  
  261. struct twcabal    // used in struct _CABAL_
  262.     {
  263.         unsigned    Location;                // location of this group
  264.         unsigned    Goal;                    // goal of this cabal group
  265.         unsigned    Fighters;                // fighters in this group
  266.     };
  267.  
  268. /*  struct _CABAL_
  269.  
  270.     -- file structure for each record of TWCABAL.DAT
  271.  
  272. */
  273. struct _CABAL_
  274.     {
  275.         unsigned    Regeneration;            // cabal regeneration
  276.         unsigned    Hq;                      // cabal HQ location
  277.         unsigned    Secondary;               // secondary force location
  278.         unsigned    Location1;               // location around base #1
  279.         unsigned    Location2;               // location around base #2
  280.         unsigned    Location3;               // location around base #3
  281.         unsigned    Location4;               // location around base #4
  282.         unsigned    Location5;               // location around base #5
  283.         unsigned    Location6;               // location around base #6
  284.         unsigned    GroupType2;              // number of cabal group 2 ftrs
  285.         unsigned    GroupType3;              // number of cabal group 3 ftrs
  286.         char        Strength;                // cabal strength level 1 - 10
  287.         struct      twcabal Group[50];       // Array of all 50 group locs
  288.     };
  289.  
  290. /*  struct _PLYRMSG
  291.  
  292.     -- file structure for each record of TWPMESS.DAT
  293.  
  294. */
  295. struct _PLYRMSG
  296.     {
  297.         unsigned    To;                      // player msg is to and total #
  298.         unsigned    Active;                  // is msg active?
  299.         int         From;                    // player who killed above ftrs
  300.         unsigned    Destroyed;               // fighters destroyed by above
  301.     };
  302.  
  303. /*  struct _TEAM
  304.  
  305.     -- file structure for each record of TWTEAM.DAT
  306.  
  307. */
  308. struct _TEAM
  309.     {
  310.         char        Name[30];                // name of team
  311.         char        Password[9];             // password to join team
  312.         unsigned    Players;                 // number of players on team
  313.         unsigned    Captain;                 // active/team captain
  314.     };
  315.  
  316. // General TW2 options  used in _TWMAIN.TWOptions
  317.  
  318. #define ALIASES         0x00000001           // Aliases
  319. #define NETWORK         0x00000002           // Networking
  320. #define NEWS            0x00000004           // News/MsgstoSysop
  321. #define DEBUG           0x00000008           // Debug mode
  322. #define GMON            0x00000010           // GMon
  323. #define EXTERNM         0x00000020           // External Maintenance
  324. #define LOCALPW         0x00000040           // Password entry
  325. #define SALES           0x00000080           // Sales of products
  326. #define SURRENDER       0x00000100           // Surrendering?
  327. #define SHOWDEAD        0x00000200           // Show dead in rankings?
  328. #define RESERVED1       0x00000400
  329. #define RESTRICTED      0x00000800           // restrict good players from plane 0
  330. #define ALLOWKLOAK      0x00001000           // Allow kloaking?
  331. #define KEEPSAVINGS     0x00002000           // keep savings when killed?
  332. #define RESERVED2       0x00004000
  333. #define ISNETWORKED     0x00008000           // in TW network mode?
  334. #define ISNETHOST       0x00010000           // TW network host?
  335. #define NOUNIONATTACKS  0x00020000           // no attacks allowed in Union
  336. #define MUZAKOK         0x00040000           // Local muzak okay??
  337. #define GGGRAPHICSOK    0x00080000           // Local Graphics Okay?
  338. #define COMMITDATA      0x00100000           // commit data to disk?
  339.  
  340. // defense force options - used in Sector & Planet Defense force options
  341. #define TEAMDF      0x0001                   // team defense force
  342. #define ATTACKALL   0x0002                   // Defense force attacks anyone
  343. #define ATTACKNONE  0x0004                   // attacks no one
  344. #define ATTACKTEAM  0x0008                   // attack certain team
  345. #define ATTACKPLYR  0x0010                   // attack certain player
  346.